package ahblue.cn.tanzi.ui.msg.model;

import android.content.Context;
import android.widget.Toast;

import java.util.List;

import ahblue.cn.tanzi.data.source.ApiCallback;
import ahblue.cn.tanzi.data.source.RemoteRepository;

/**
 * @author pink-jackstraw
 * @date 2018/11/28
 * @describe
 */
public class FriendModel {

    public String appkey;
    public String mtime;
    public String ctime;
    public String username;
    public String avatar;

    public static void getFriends(final Context context, String token, final FriendListStatus loginListener){
        RemoteRepository repo = RemoteRepository.getsInstance();
        repo.getFriends(token, new ApiCallback<List<FriendModel>>(){
            @Override
            public void onSuccess(List<FriendModel> data) {
                if (null!=loginListener){
                    loginListener.conver(data);
                }
            }
            @Override
            public void onFailed(String errorMsg) {
                Toast.makeText(context,errorMsg,Toast.LENGTH_LONG).show();
                if (null!=loginListener){
                    loginListener.conver(null);
                }
            }
        });
    }


    public interface FriendListStatus {
        void conver(List<FriendModel> model);
    }

}
